<?php

App::uses("ValuesBuildSql", "Wchart.Lib/chart");
App::uses("ValuesBuildXml", "Wchart.Lib/chart");
App::uses("ValuesBuildWebservices", "Wchart.Lib/chart");
App::uses("ValuesBuildClass", "Wchart.Lib/chart");

class ValuesBuildFactory {

	private $valuesBuild = null;
	private $serie = null;

	public function __construct($serie) {
		$this->serie=$serie;
	}
	
	function getValuesInstance() {
		$instance = null;
		switch ($this->serie["type"]) {
			case SERIE_TYPE_SQL:
				$instance = new ValuesBuildSql($this->serie);
				break;
			case SERIE_TYPE_XML:
				$instance = new ValuesBuildXml($this->serie);
				break;
			case SERIE_TYPE_WEBSERVICES:
				$instance = new ValuesBuildWebservices($this->serie);
				break;
			case SERIE_TYPE_CLASS:
				$instance = new ValuesBuildClass($this->serie);
				break;
			default:
				throw new NotFoundException(__("Tipo Serie non supportata."));
				break;
		}
		return $instance; 
	}
	
}
?>